package org.example.demo21.iterator.impl;

import org.example.demo21.iterator.DrinkIterator;
import org.example.demo21.iterator.DrinkMenu;
import org.example.demo21.iterator.entity.MenuItem;
import org.example.demo21.iterator.iter.CoffeeIter;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author guocong
 * @since 2024/4/1 14:19
 */
@Component
public class CoffeeMenu implements DrinkMenu {

    List<MenuItem> items;

    public CoffeeMenu() {
        items = new ArrayList<>();
        addItem(1, "生椰拿铁", "贼经典。。。");
        addItem(2, "白梨拿铁", "新品超好喝");
        addItem(3, "美式黑咖", "怪苦的");
        addItem(4, "茉莉拿铁", "热的不好喝");
        addItem(5, "陨石厚乳", "还行吧，指定比美式甜");
    }


    @Override
    public void addItem(int code, String name, String description) {
        MenuItem coffeeItem = new MenuItem(name, description, code);
        items.add(coffeeItem);
    }

    @Override
    public DrinkIterator createIter() {
        return new CoffeeIter(items);
    }

}
